﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Ken_WPF_UI.View
{
    /// <summary>
    /// MenuWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MenuWindow : Window
    {
        public MenuWindow()
        {
            InitializeComponent();
        }

        private void UserMenuItem_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("点击了用户菜单");
        }

        private void RoleMenuItem_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("点击了角色菜单");
        }


        private void AreaMenuItem_Click(object sender, RoutedEventArgs e)
        {
            if(sender is MenuWindow)
            {
                MenuWindow menuWindow = sender as MenuWindow;

                InputBindingCollection inputBindings = menuWindow.InputBindings;
                for (int i = 0; i < inputBindings.Count; i++)
                {
                    //Console.WriteLine(inputBindings[i].GetValue());
                    //Console.WriteLine(inputBindings[i].Gesture.Matches(myAreaMenu, (InputEventArgs)e));
                }
                MessageBox.Show("使用了Ctrl+O 快捷键 触发 点击了地区菜单");
                RoutedEvent routedEvent = e.RoutedEvent;
                return;
            }

           

            MessageBox.Show("点击了地区菜单");
        }

        /// <summary>
        /// 进入动态菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Label_MouseEnter(object sender, MouseEventArgs e)
        {
            
        }

        private void Label_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MenuWindow2 menu = new MenuWindow2();
            menu.Owner = this;
            menu.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            menu.Show();
        }
    }
}
